package com.itheima.springboot_04_autoo.mapper;

import com.itheima.springboot_04_autoo.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {

    // 根据ID删除用户
    @Delete("delete from tb_user where id = #{id}")
    public void deleteById(Integer id);

    // 新增用户
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tb_user(id,username,password,gender,addr)" +
            " values (#{id},#{username},#{password},#{gender},#{addr})")
    public void insert(User user);

    // 更新用户
    @Update("update tb_user set username=#{userName}, password=#{password}, gender=#{gender}, addr=#{addr} where id = #{id}")
    public void update(User user);

    // 条件查询用户

}
